Add vendor approval flow with VendorStatus enum#35
Merged
EmeditWeb merged 2 commits intoJun 22, 2026
Merged
Conversation
Replaced the active: bool field in VendorInfo with a VendorStatus enum (Pending, Approved, Suspended, Rejected). register_vendor() now sets new vendors to Pending instead of immediately active. Added admin-only approve_vendor() and suspend_vendor() functions. Updated is_active() to return true only for Approved vendors, which automatically gates loan creation in creditline-contract via its existing validate_vendor() call. Legacy functions (activate_vendor, deactivate_vendor, set_vendor_status) map to the new enum for backward compatibility. Updated all tests and creditline test helpers to register + approve vendors before creating loans. Files touched: vendor-registry-contract/src/lib.rs, vendor-registry-contract/src/types.rs, vendor-registry-contract/src/events.rs, vendor-registry-contract/src/errors.rs, vendor-registry-contract/src/tests.rs, creditline-contract/src/tests.rs Closed StepFi-app#23
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request #23
Description
Replaced the active: bool field in VendorInfo with a VendorStatus enum (Pending, Approved, Suspended, Rejected). register_vendor() now sets new vendors to Pending instead of immediately active. Added admin-only approve_vendor() and suspend_vendor() functions. Updated is_active() to return true only for Approved vendors, which automatically gates loan creation in creditline-contract via its existing validate_vendor() call. Legacy functions (activate_vendor, deactivate_vendor, set_vendor_status) map to the new enum for backward compatibility. Updated all tests and creditline test helpers to register + approve vendors before creating loans.
Files touched: vendor-registry-contract/src/lib.rs, vendor-registry-contract/src/types.rs, vendor-registry-contract/src/events.rs, vendor-registry-contract/src/errors.rs, vendor-registry-contract/src/tests.rs, creditline-contract/src/tests.rs
Type of Change
Changes Made
Added VendorStatus enum (Pending, Approved, Suspended, Rejected) to types.rs
Testing
Checklist
Closed #23